package com.happyfamily.springboot.crowdsourcingplatform.service.weng.impl;

import com.happyfamily.springboot.crowdsourcingplatform.base.result.Results;
import com.happyfamily.springboot.crowdsourcingplatform.dao.weng.BackAllianceDao;
import com.happyfamily.springboot.crowdsourcingplatform.model.Alliance;
import com.happyfamily.springboot.crowdsourcingplatform.service.weng.BackAllianceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional(rollbackFor = Exception.class)
public class BackAllianceServiceImpl implements BackAllianceService
{
	@Autowired
	BackAllianceDao backAllianceDao;

	@Override
	public Results<Alliance> getAllAllianceByPage(Integer startPosition, Integer limit)
	{
		return Results.success(backAllianceDao.countAllAlliance().intValue(), backAllianceDao.getAllAllianceByPage(startPosition, limit));
	}

	@Override
	public Results<Alliance> getAllianceByFuzzy(String aname, String sid, Integer startPosition, Integer limit)
	{
		return Results.success(backAllianceDao.getAllianceByFuzzy(aname, sid).intValue(), backAllianceDao.getAllianceByFuzzyPage(aname, sid, startPosition, limit));
	}
}
